/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.alipay.sofa.registry.server.data.event;

import java.util.Map;
import java.util.Set;

import com.alipay.sofa.registry.common.model.metaserver.DataNode;

/**
 *
 * @author qian.lqlq
 * @version $Id: LocalDataServerChangeEvent.java, v 0.1 2018-05-07 20:13 qian.lqlq Exp $
 */
public class LocalDataServerChangeEvent implements Event {

    private Map<String, DataNode> localDataServerMap;

    private long                  localDataCenterversion;

    private Set<String>           newJoined;

    private long                  version;

    /**
     * constructor
     * @param localDataServerMap
     * @param newJoined
     * @param version
     * @param localDataCenterversion
     */
    public LocalDataServerChangeEvent(Map<String, DataNode> localDataServerMap,
                                      Set<String> newJoined, long version,
                                      long localDataCenterversion) {
        this.localDataServerMap = localDataServerMap;
        this.newJoined = newJoined;
        this.version = version;
        this.localDataCenterversion = localDataCenterversion;
    }

    /**
     * Getter method for property <tt>localDataServerMap</tt>.
     *
     * @return property value of localDataServerMap
     */
    public Map<String, DataNode> getLocalDataServerMap() {
        return localDataServerMap;
    }

    /**
     * Getter method for property <tt>version</tt>.
     *
     * @return property value of version
     */
    public long getVersion() {
        return version;
    }

    /**
     * Getter method for property <tt>newJoined</tt>.
     *
     * @return property value of newJoined
     */
    public Set<String> getNewJoined() {
        return newJoined;
    }

    /**
     * Getter method for property <tt>localDataCenterversion</tt>.
     *
     * @return property value of localDataCenterversion
     */
    public long getLocalDataCenterversion() {
        return localDataCenterversion;
    }

    /**
     * @see Object#toString()
     */
    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("LocalDataServerChangeEvent{");
        sb.append("localDataServerMap=").append(localDataServerMap);
        sb.append(", localDataCenterversion=").append(localDataCenterversion);
        sb.append(", newJoined=").append(newJoined);
        sb.append(", version=").append(version);
        sb.append('}');
        return sb.toString();
    }
}